export class Result<T = any> {
  code: number
  msg: string
  data: T
  constructor(code: number, msg: string, data: T) {
    this.code = code
    this.msg = msg
    this.data = data
  }

  static Ok<T>(data: T, code = 200, msg = '操作成功') {
    return new Result(code, msg, data)
  }

  static Error<T>(msg = '操作失败', code = 400, err?: T) {
    return new Result(code, msg, err)
  }
}
